<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户信息修改</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.2/css/bootstrap.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div th:replace="fragments/header :: navbar"></div>
<div class="container pt-5">
    <div class="row">
        <div class="container">
            <h3 class="text-center">用户个人信息</h3>
            <div class="row d-flex justify-content-center">
                <div th:fragment="userForm" class="col-md-4">
                    <div class="alert alert-success" th:if="${successMessage}" th:utext="${successMessage}"></div>
                    <form name="userForm" role="form" method="post" th:object="${user}" th:action="@{/users/edit}">
                        <div class="form-group">
                            <input type="hidden" class="form-control" id="id" name="id" th:field="*{userId}"/>
                        </div>
                        <div class="form-group">
                            <label  class="form-control-label" for="login">用户登录名 </label>
                            <input type="text" class="form-control" id="login" name="login" th:field="*{userName}"  readonly/>
                        </div>
                        <div class="form-group">
                            <label class="form-control-label" for="userFullname">用户全名</label>
                            <input type="text" class="form-control" id="userFullname" name="userFullname" th:field="*{userFullname}" readonly/>
                        </div>
                        <div class="form-group">
                            <label class="form-control-label" for="userPhone">用户电话</label>
                            <input type="text" class="form-control" id="userPhone" name="userPhone" th:field="*{userPhone}" required
                                   maxlength="11" pattern="^[0-9]*$" />
                            <div th:if="${#fields.hasErrors('userPhone')}">
                                <small class="form-text text-danger" th:errors="*{userPhone}" ></small>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="form-control-label" for="userAddress">用户地址</label>
                            <input type="text" class="form-control" id="userAddress" name="userAddress" th:field="*{userAddress}" required
                                   maxlength="120" pattern="^[\u4e00-\u9fa5_a-zA-z-0-9]*$" />
                            <div th:if="${#fields.hasErrors('userAddress')}">
                                <small class="form-text text-danger" th:errors="*{userAddress}" ></small>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="form-control-label" for="userBankcard">用户银行卡号</label>
                            <input type="text" class="form-control" id="userBankcard" name="userBankcard" th:field="*{userBankcard}" readonly/>
                        </div>
                        <div class="col-12 text-right">
                            <a type="button" class="btn btn-secondary" th:href="@{/}">返回</a>
                            <button type="submit" class="btn btn-primary">信息更新</button>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js" integrity="sha384-ep+dxp/oz2RKF89ALMPGc7Z89QFa32C8Uv1A3TcEK8sMzXVysblLA3+eJWTzPJzT" crossorigin="anonymous"></script>

</html>